<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="CustomerForm.aspx.cs" Inherits="Sample.CustomerForm" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Customer</title>
</head>
<body>
    <form id="form1" runat="server">
    <asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
    <table>
        
        <tr>
            <td>Customer Name</td>
            <td>:</td>
            <td>
                <% if(GetDisplayType == Sample.CustomerForm.DisplayType.Add) { %>
                <asp:TextBox ID="CustomerCustomerNameInput" runat="server" MaxLength="50"></asp:TextBox>
      <asp:RequiredFieldValidator ID="CustomerCustomerNameRequiredValidator" runat="server" ErrorMessage="This field is required" ControlToValidate="CustomerCustomerNameInput"></asp:RequiredFieldValidator>
                <% } else { %>
                <asp:Label ID="CustomerCustomerNameDisplay" runat="server" Text=""></asp:Label>
                <% } %>
            </td>
        </tr>
        
        <tr>
            <td>Customer Type</td>
            <td>:</td>
            <td>
                <% if(GetDisplayType == Sample.CustomerForm.DisplayType.Add) { %>
                <asp:DropDownList ID="CustomerTypeIdInput" runat="server"></asp:DropDownList>
                <% } else { %>
                <asp:Label ID="CustomerCustomerTypeDisplay" runat="server" Text=""></asp:Label>
                <% } %>
            </td>
        </tr>
        
        <tr>
            <td>Customer Description</td>
            <td>:</td>
            <td>
                <% if(GetDisplayType == Sample.CustomerForm.DisplayType.Add) { %>
                <asp:TextBox ID="CustomerCustomerDescriptionInput" runat="server" MaxLength="0"></asp:TextBox>
      
                <% } else { %>
                <asp:Label ID="CustomerCustomerDescriptionDisplay" runat="server" Text=""></asp:Label>
                <% } %>
            </td>
        </tr>
        
        <tr>
            <td colspan="3">
                <asp:GridView ID="CustomerLineGrid" runat="server" AutoGenerateColumns="false" 
                    ShowFooter="false" DataKeyNames="Id">
                <Columns>
                    <asp:BoundField DataField="Id" ItemStyle-CssClass="HideElement"
                        HeaderStyle-CssClass="HideElement" FooterStyle-CssClass="HideElement" />
                    <asp:TemplateField>
                        <ItemTemplate><%# Container.DataItemIndex + 1 %></ItemTemplate>
                    </asp:TemplateField>
                    <asp:TemplateField>
                        <HeaderTemplate>Order Name</HeaderTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="CustomerOrderOrderNameInput" runat="server" MaxLength="50"></asp:TextBox>
      <asp:RequiredFieldValidator ID="CustomerOrderOrderNameRequiredValidator" runat="server" ErrorMessage="This field is required" ControlToValidate="CustomerOrderOrderNameInput"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <%# Eval("OrderName") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField>
                        <HeaderTemplate>Quantity</HeaderTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="CustomerOrderQuantityInput" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="CustomerOrderQuantityRequiredValidator" runat="server" ErrorMessage="This field is required" ControlToValidate="CustomerOrderQuantityInput"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <%# Eval("Quantity") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                </Columns>
                </asp:GridView>
                
                    <asp:TemplateField>
                        <HeaderTemplate>Order Name</HeaderTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="CustomerOrderOrderNameInput" runat="server" MaxLength="50"></asp:TextBox>
      <asp:RequiredFieldValidator ID="CustomerOrderOrderNameRequiredValidator" runat="server" ErrorMessage="This field is required" ControlToValidate="CustomerOrderOrderNameInput"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <%# Eval("OrderName") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField>
                        <HeaderTemplate>Quantity</HeaderTemplate>
                        <EditItemTemplate>
                            <asp:TextBox ID="CustomerOrderQuantityInput" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="CustomerOrderQuantityRequiredValidator" runat="server" ErrorMessage="This field is required" ControlToValidate="CustomerOrderQuantityInput"></asp:RequiredFieldValidator>
                        </EditItemTemplate>
                        <ItemTemplate>
                            <%# Eval("Quantity") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
            </td>
        </tr>
        
        <tr>
            <td colspan="3">
                <asp:Button ID="CustomerSaveButton" runat="server" Text="Save" OnClick="CustomerSaveButton_Click" />
                <asp:Button ID="CustomerCancelButton" runat="server" Text="Cancel" OnClick="CustomerCancelButton_Click" />
            </td>
        </tr>
    </table>
    </form>
</body>
</html>